package com.dreammakerteam.frameworkdemo.base.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.dreammakerteam.frameworkdemo.base.domain.DataTablsResult;
import com.dreammakerteam.frameworkdemo.base.domain.DUserDo;
import com.dreammakerteam.frameworkdemo.base.service.DUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 用户前端控制器
 * Created by ty850 on 2017/9/11.
 */
@Controller
@RequestMapping("/admin/user")
public class DUserController extends DBaseController {

    private DUserService dAUserService;
    public DUserController(DUserService dAUserService) {
        this.dAUserService = dAUserService;
    }

    @RequestMapping
    public String index() {
        return "admin/user/index";
    }

    @RequestMapping("/addUser")
    @ResponseBody
    public void addUser() {

    }

    @RequestMapping("/getUsers")
//    @RequiresRoles("aaaa")
    @ResponseBody
    public Object getUsers(Integer draw, Integer start, Integer length) {



        Page<DUserDo> page = new Page<>(start, length);
        page.setRecords(dAUserService.getMapper().selectPage(page, null));
        return DataTablsResult.valueOf(page, draw);
    }

    public void getUser() {

    }

    
}
